#include "Stdafx.h"
#include "Direct3DIndexBuffer9.h"

using namespace Vortex::Wrapper::Direct3D;

Direct3DIndexBuffer9::Direct3DIndexBuffer9(IDirect3DIndexBuffer9* handle) : _handle(handle) {	
}

Direct3DIndexBuffer9::~Direct3DIndexBuffer9() {
	_handle->Release();
}

HResult Direct3DIndexBuffer9::Lock(UINT offsetToLock, UINT sizeToLock, [Out] void*% pData, D3DLockFlags lockFlags) {
	void* pDataPtr = NULL;
	HResult hr = HResult(_handle->Lock(offsetToLock, sizeToLock, &pDataPtr, (DWORD)lockFlags));
	pData = pDataPtr;
	return hr;
}

HResult Direct3DIndexBuffer9::Unlock() {
	return HResult(_handle->Unlock());
}